

**************************************************************
******************** Replication code for ********************
******** "Foreign Agents? Public Attitudes toward..." ********
**** NGOs in a Backsliding Democracy",  Political Studies ****
****************** Asif Efrat and Omer Yair ******************
**************************************************************


* Setting the working directory
cd <<<"ADD DIRECTORY HERE">>>

* Upload the .dta dataset
use "NGO_dataset.dta", clear


** Descriptive statistics **
sum age
tab gender
tab jewish
tab ideo_bloc


***********
*** DVs ***
***********
tab1 DV1_for_interests- DV8_Knesset_committees

recode DV1_for_interests (6=.), gen (DV1)
recode DV2_too_much_influence (6=.), gen (DV2)
recode DV3_influ_undem (6=.), gen (DV3)
recode DV4_political_bodies (6=.), gen (DV4)
recode DV5_sensitive_issues (6=.), gen (DV5)
recode DV6_foreign_funding (6=.), gen (DV6)
recode DV7_more_transperacy (6=.), gen (DV7)
recode DV8_Knesset_committees (6=.), gen (DV8)
sum DV1-DV8


*************************************
** EFA and scale reliability tests **
*************************************

* For all 8 items (preregistered; see Section E of the Online Appendix): 
alpha DV1-DV8, i /*alpha=.8*/
factor DV1-DV8, ipf /*one factor (84.3% variance explained)*/ 
paran DV1-DV8 /* not preregistered..*/

** The first DV (Negative perceptions):
alpha DV1-DV4, i /*alpha=.79*/
factor DV1-DV4, ipf /*one factor (97.1% variance explained)*/ 

/*
The first DV was created using the following code:
egen DV_neg_perceptions=rowmean(DV1 DV2 DV3 DV4)
replace DV_neg_perceptions=(DV_neg_perceptions-1)/4
*/

** The first DV (Negative perceptions):
alpha DV5-DV8, i /*alpha=.74*/
factor DV5-DV8, ipf /*one factor (91.9% variance explained)*/
/*
The second DV was created using the following code:
egen DV_restrictions=rowmean(DV5 DV6 DV7 DV8)
replace DV_restrictions=(DV_restrictions-1)/4
*/
drop DV1-DV8

* Summary stats for the two DVs
sum DV_neg_perceptions DV_restrictions
*pwcorr DV_neg_perceptions DV_restrictions, sig obs



*********************
** Testing H1 & H2 **
*********************

/*
*** First DV (perceptions) ***
ttest DV_neg_perceptions, by (foreign_NGO_cond) /*p<.001*/
esize twosample DV_neg_perceptions, by (foreign_NGO_cond) /* Cohen d = 0.23 */
*** Second DV (Restrictions) ***
ttest DV_restrictions, by (foreign_NGO_cond) /*p=.448*/
esize twosample DV_restrictions, by (foreign_NGO_cond) /* Cohen d = 0.03 */
*/


** Table 1 **

* Model 1
reg DV_neg_perceptions i.foreign_NGO_cond /*The preregistered regression model*/
outreg2 using Table1.doc, replace se dec(2) alpha (.02, .1) symbol (**, *)

* Model 2
reg DV_neg_perceptions i.foreign_NGO_cond##i.left_NGO_cond /*a preregistered RT*/
outreg2 using Table1.doc, append se dec(2) alpha (.02, .1) symbol (**, *)

* Model 3
reg DV_restrictions i.foreign_NGO_cond  /*The preregistered regression model*/
outreg2 using Table1.doc, append se dec(2) alpha (.02, .1) symbol (**, *)

* Model 4
reg DV_restrictions i.foreign_NGO_cond##i.left_NGO_cond /*a preregistered RT*/
outreg2 using Table1.doc, append se dec(2) alpha (.02, .1) symbol (**, *)



** Figure 1 **

* Negative Perceptions
cibar DV_neg_perceptions, over1(foreign_NGO_cond) level(95) barcol(gs13 gs5) barlabel(on) blf(%9.2f) blposition(10) bargap(10) graphopts(ylabel(,) graphregion(color(white)) ytitle("") title("A. Negative Perceptions"))
graph save "Graph1.gph", replace

* Restrictions
cibar DV_restrictions, over1(foreign_NGO_cond) level(95) barcol(gs13 gs5) barlabel(on) blf(%9.2f) blposition(10) bargap(10) graphopts(ylabel(,) graphregion(color(white)) ytitle("") title("B. Restrictions"))
graph save "Graph2.gph", replace

** Figure 1 - Combining H1 figures **
grc1leg Graph1.gph Graph2.gph, ///
ycommon xcommon row(1) graphregion(color(white)) 

erase Graph1.gph 
erase Graph2.gph


** Testing differences b/w the first three conditions (Euro. Gov/US Gov. rich foreign donors)
oneway DV_neg_perceptions NGO_conditions if NGO_conditions<4, t
oneway DV_restrictions NGO_conditions if NGO_conditions<4, t


****************
** Testing H3 **
****************

/*
** First DV (Negative Perceptions) **
anova DV_neg_perceptions i.right_left_R##i.left_NGO_cond if NGO_conditions>2 /*p<.001; eta2=0.23*/
ttest DV_neg_perceptions if NGO_conditions>2  , by (ideo_mismatch) /*p<.001*/
esize twosample DV_neg_perceptions if NGO_conditions>2 , by (ideo_mismatch) /* Cohen d = 0.85 */
** Second DV (Restrictions) **
anova DV_restrictions i.right_left_R##i.left_NGO_cond if NGO_conditions>2 /*p<.001; eta2=0.19*/
ttest DV_restrictions if NGO_conditions>2, by (ideo_mismatch) /*p<.001*/
esize twosample DV_restrictions if NGO_conditions>2, by (ideo_mismatch) /* Cohen d = 0.66 */
*/


** Table 2 **

* Model 1
reg DV_neg_perceptions i.right_left_R##i.left_NGO_cond if NGO_conditions>2 /* a minor deviation from the pre-reg*/
outreg2 using Table2.doc, replace se dec(2) alpha (.02, .1) symbol (**, *)
reg DV_neg_perceptions i.right_left_R##i.left_NGO_cond /* a minor RT*/

* Model 2
reg DV_restrictions i.right_left_R##i.left_NGO_cond if NGO_conditions>2 /* a minor deviation from the pre-reg*/
outreg2 using Table2.doc, append se dec(2) alpha (.02, .1) symbol (**, *)
reg DV_restrictions i.right_left_R##i.left_NGO_cond /* a minor RT*/


** Effect size estimates **
esize twosample DV_neg_perceptions if right_left_R==0 & NGO_conditions>2, by (ideo_mismatch) /* Cohen d = 0.73 */
esize twosample DV_neg_perceptions if right_left_R==1 & NGO_conditions>2, by (ideo_mismatch) /* Cohen d = 0.92 */
esize twosample DV_restrictions if right_left_R==0 & NGO_conditions>2, by (ideo_mismatch) /* Cohen d = 0.67 */
esize twosample DV_restrictions if right_left_R==1 & NGO_conditions>2, by (ideo_mismatch) /* Cohen d = 0.68 */


** Figure 2 **

* Negative Perceptions
cibar DV_neg_perceptions if NGO_conditions>2, over1(right_left_R) over2(left_NGO_cond) level(95) barcol(gs13 gs5) barlabel(on) blf(%9.2f) blposition(10) bargap(10) graphopts(ylabel(,) graphregion(color(white)) ytitle("") title("A. Negative Perceptions"))
graph save "Graph1.gph", replace

* Restrictions
cibar DV_restrictions if NGO_conditions>2, over1(right_left_R) over2(left_NGO_cond) level(95) barcol(gs13 gs5) barlabel(on) blf(%9.2f) blposition(10) bargap(10) graphopts(ylabel(,) graphregion(color(white)) ytitle("") title("B. Restrictions"))
graph save "Graph2.gph", replace

** Figure 2 - Combining H2 figures **
grc1leg Graph1.gph Graph2.gph, ///
ycommon xcommon row(1) graphregion(color(white)) 

erase Graph1.gph 
erase Graph2.gph




***********************
*** Online Appendix ***
***********************

*****************************************
*** Section A: descriptive statistics ***
*****************************************
sum age
tab gender
tab jewish
tab college_educ
tab ideo_bloc


********************************
*** Section C: balance tests ***
********************************

oneway age NGO_conditions, t
oneway age foreign_NGO_cond, t
oneway age right_NGO_cond, t

tab gender NGO_conditions, chi col
tab gender foreign_NGO_cond, chi col
tab gender right_NGO_cond, chi col

tab jewish NGO_conditions, chi col
tab jewish foreign_NGO_cond, chi col
tab jewish right_NGO_cond, chi col

tab college_educ NGO_conditions, chi col
tab college_educ foreign_NGO_cond, chi col
tab college_educ right_NGO_cond, chi col

tab religiosity NGO_conditions, chi col
tab religiosity foreign_NGO_cond, chi col
tab religiosity right_NGO_cond, chi col

tab ideo_bloc NGO_conditions, chi col
tab ideo_bloc foreign_NGO_cond, chi col
tab ideo_bloc right_NGO_cond, chi col


mlogit NGO_conditions age gender jewish college_educ religiosity ideo_bloc /*p=.979*/
mlogit foreign_NGO_cond age gender jewish college_educ religiosity ideo_bloc /*p=.709*/
mlogit right_NGO_cond age gender jewish college_educ religiosity ideo_bloc /*p=.899*/



***********************************
*** Section D: robustness tests ***
***********************************

** Table D1 - Similar to Table 1, but with individual-level controls **
* Model 1
reg DV_neg_perceptions i.foreign_NGO_cond age i.gender i.college_educ ///
i.jewish religiosity i.ideo_bloc
outreg2 using TableD1.doc, replace se dec(2) alpha (.02, .1) symbol (**, *)

* Model 2
reg DV_neg_perceptions i.foreign_NGO_cond##i.left_NGO_cond age i.gender i.college_educ  ///
i.jewish religiosity i.ideo_bloc
outreg2 using TableD1.doc, append se dec(2) alpha (.02, .1) symbol (**, *)

* Model 3
reg DV_restrictions i.foreign_NGO_cond age i.gender i.college_educ  ///
i.jewish religiosity i.ideo_bloc
outreg2 using TableD1.doc, append se dec(2) alpha (.02, .1) symbol (**, *)

* Model 4
reg DV_restrictions i.foreign_NGO_cond##i.left_NGO_cond age i.gender i.college_educ  ///
i.jewish religiosity i.ideo_bloc
outreg2 using TableD1.doc, append se dec(2) alpha (.02, .1) symbol (**, *)



** Table D2 - Similar to Table 2, but with individual-level controls **
* Model 1
reg DV_neg_perceptions i.right_left_R##i.left_NGO_cond age i.gender i.college_educ ///
i.jewish religiosity if NGO_conditions>2 
outreg2 using TableD2.doc, replace se dec(2) alpha (.02, .1) symbol (**, *)

* Model 2
reg DV_restrictions i.right_left_R##i.left_NGO_cond age i.gender i.college_educ ///
i.jewish religiosity if NGO_conditions>2 
outreg2 using TableD2.doc, append se dec(2) alpha (.02, .1) symbol (**, *)



** Table D3 - Similar to Table 2, but with all six experimental conditions **
* Model 1
reg DV_neg_perceptions i.right_left_R##i.left_NGO_cond 
outreg2 using TableD3.doc, replace se dec(2) alpha (.02, .1) symbol (**, *)

* Model 2
reg DV_restrictions i.right_left_R##i.left_NGO_cond 
outreg2 using TableD3.doc, append se dec(2) alpha (.02, .1) symbol (**, *)


